package com.example.basicquestions.questions.单词反转;

import java.util.*;

/**
 * @author liw
 * @date 2023-03-10
 */
public class Test {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        String str = scanner.nextLine();
        String tmp = "";
        String res = "";
        for(int i=0; i<str.length(); i++){
            char c = str.charAt(i);
            if(Character.isLetter(c)){
                tmp+=c;
            }else if(c == ' '){
                res += reverse(tmp)+" ";
                tmp = "";
            }else{
                res += reverse(tmp)+c;
                tmp = "";
            }
        }
        System.out.println(res);
    }

    public static String reverse(String str){
        StringBuilder tmp = new StringBuilder(str);
        String res = tmp.reverse().toString();
        return res;
    }
}
